/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package desarrollosoft.ghce.dao.implementaciones;

import desarrollosoft.ghce.dao.interfaces.ITipoDocumentoDAO;
import desarrollosoft.ghce.entidades.TipoDocumento;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.springframework.stereotype.Repository;

/**
 *
 * @author ariel
 */
@Repository("tipoDocumentoDAO")
public class TipoDocumentoDAO implements ITipoDocumentoDAO {

    @PersistenceContext
    EntityManager entityManager;
    
    @Override
    public List<TipoDocumento> obtenerTodosTipoDocumento() {
        Query q = entityManager.createQuery(
                "SELECT t FROM TipoDocumento t ORDER BY t.nombre ASC"
        );
        return q.getResultList();
    }
    
}
